<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>上传视频</title>
    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
    <link rel="stylesheet" href="../../layui/css/layui.css">
</head>
<body>

    <form class="layui-form" action="../../createVideo.do" method="post" enctype="multipart/form-data">
        <div class="layui-form-item">
            <label class="layui-form-label">视频名称</label>
            <div class="layui-input-block">
                <input class="layui-input" type="text" name="vName" required  lay-verify="required" placeholder="请输入视频名称">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">封面</label>
            <div class="layui-input-block">
                <input class="layui-input" type="file" name="coverFile" required  lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">视频</label>
            <div class="layui-input-block">
                <input class="layui-input" type="file" name="videoFile" required  lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否会员</label>
            <div class="layui-input-block">
                <select name="isVip" lay-verify="required">
                    <option value=""></option>
                    <option value="0">会员</option>
                    <option value="1">非会员</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">导演</label>
            <div class="layui-input-block">
                <input type="text" name="director" placeholder="请输入导演" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-block">
                <select id="tid" name="tid" lay-verify="required">
                    <option value=""></option>
                    <option value="0">会员</option>
                    <option value="1">非会员</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input class="layui-btn" type="submit" value="提交">
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <script src="../../layui/layui.js"></script>
    <script>
        layui.use(['form','jquery','layer'], function(){
            var form = layui.form,
                layer = layui.layer,
                $ = layui.jquery;

            $("#tid").empty();
            $.ajaxSettings.async = false;//同步
            $.post(("../../selectAllType.do"),{},function(result){
                if(result.status){
                    var tNameHtml = '';
                    var typeList = result.data;
                    for(var i = 0;i < typeList.length;i++){
                        tNameHtml += '<option value="'+typeList[i].tId+'">'+typeList[i].tName+'</option>';
                    }
                    $("#tid").append(tNameHtml);
                }else{
                    layer.msg(result.message);
                }
            },"json");
            form.render();
            //监听重置
            form.on('reset(formDemo)', function(data){
                return false;
            });
        });

    </script>
</body>
</html>